//tableColumn组件

<template>
  <el-table-column
    :prop="headColumn.prop"
    :align="headColumn.align || 'center'"
    :width="headColumn.width || ''"
    :label="headColumn.label"
  >
    <template v-for="(columnData,index) in headColumn.children">
      <tableColumn
        v-if="columnData.children && columnData.children.length>0"
        :key="index"
        :head-column="columnData"
      />
      <el-table-column
        v-else
        :key="index"
        :prop="columnData.prop"
        :align="columnData.align || 'center'"
        :width="columnData.width || ''"
        :label="columnData.label"
      >
        <template slot-scope="scope">
          <div v-if="scope.row.belong_hour === 'total' ">
            <span v-if="columnData.countType === '0'">——</span>
            <span v-else-if="scope.column.property === 'FIT103_2_5_ACC'&&scope.column.property in scope.row">{{ parseInt(scope.row[scope.column.property])+parseInt(scope.row["FIT103_1_5_ACC"]) }}</span>
            <span v-else>{{ scope.row[scope.column.property] }}</span>
          </div>
          <div v-else-if="scope.row.belong_hour === 'max'||scope.row.belong_hour === 'min' ">
            <span v-if="columnData.countType === '2'">——</span>
            <span v-else>{{ scope.row[scope.column.property] }}</span>
          </div>
          <div v-else>
            <!-- <div v-if="columnData.countType==='3' ">
              <div v-if="scope.$index===0 ">
                <div v-if=" scope.column.property in statusRecord">
                  <div v-for="(runTime,index) in statusRecord[scope.column.property]" :key="index">
                    <span v-if="statusRecord[scope.column.property].length<=12||index<11">
                      {{ runTime.createTime.substring(11, 16) }}
                      <span v-if="runTime.fieldValue==='0'">关</span>
                      <span v-else-if="runTime.fieldValue==='1'">开</span>
                      <span v-else>故障</span>
                      <br>
                    </span>
                    <span v-else-if="index==11">
                      。。。
                      <br>
                    </span>
                  </div>

                </div>
                <div v-else-if=" scope.row[scope.column.property]==='开'">
                  {{ scope.row[scope.column.property] }}
                </div>
              </div>
            </div>
           -->
            <span>{{ scope.row[scope.column.property].replace(/\s/g, "\n") }}</span>
          </div>
        </template>
      </el-table-column>
    </template>
  </el-table-column>
</template>

<script>
export default {
  name: 'TableColumn', // 通过这个name进行调用
  props: {
    headColumn: {
      type: Object,
      default() {
        return {}
      }
    }

  }

}
</script>

<style scoped>
  /* .group{
  display: flex;
}
.group div{
  width: 50px;
} */
  .inline-item {
    width: 70px;
    display: block;
  }
</style>
